<%@ page import="com.product.pojo.Product" %><%--
  Created by IntelliJ IDEA.
  User: 今天要吃三碗饭
  Date: 2025/1/2
  Time: 15:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修改页面</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 20px;
        }
        .container {
            max-width: 600px;
            margin: 0 auto;
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }
        form {
            display: flex;
            flex-direction: column;
        }
        label {
            margin-top: 10px;
            font-weight: bold;
        }
        input[type="text"], select {
            padding: 10px;
            margin-top: 5px;
            border: 1px solid #ddd;
            border-radius: 4px;
        }
        input[type="submit"] {
            padding: 10px 20px;
            margin-top: 20px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        input[type="submit"]:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>
<%
    Product product=(Product) request.getAttribute("product");
%>
<div class="container">
    <form action="<%=request.getContextPath()%>/Update" method="post">
        <label for="id">商品id:</label>
        <input type="text" id="id" name="id"  value="<%=product.getId()%>" readonly/>
        <label for="name">商品名称:</label>
        <input type="text" id="name" name="name" value="<%=product.getName()%>" />
        <label for="price">商品价格:</label>
        <input type="text"  id="price" name="price"  value="<%=product.getPrice()%>" />
        <label for="type">商品类别:</label>
        <select id="type" name="type">
            <option <c:if test="${product.type == '手机'}">selected</c:if>
            >手机</option>
            <option   <c:if test="${product.type == '笔记本'}">selected</c:if>
            >笔记本</option>
            <option   <c:if test="${product.type == '电视'}">selected</c:if>
            >电视</option>
            <option   <c:if test="${product.type == '书籍'}">selected</c:if>
            >书籍</option>
        </select>

        <input type="submit" value="修改" />
    </form>
</div>
</body>
</html>